**********************************************************************************
**** Replication Data for: State-Building, Collective Efficacy, and the Co-Production of Public Goods in Rural Africa
*** Authors: Natalie Letsa and Martha Wilfahrt
** Journal: Comparative Political Studies
* File Date: 29 December 2025
**********************************************************************************

cd "/Users/marthawilfahrt/Library/CloudStorage/GoogleDrive-mawilfahrt@gmail.com/.shortcut-targets-by-id/1YQR2toLWEkHCV52GnykhtsVb1hWNDRS_/Colonial Legacies/Writing/Collective Efficacy Paper/Submissions/CPS/Letsa_Wilfahrt_CPS_Replication Files/"

use "Datasets/Original_Survey.dta", clear

****** TABLE 1: Descriptive Statistics
{
eststo Combined: quietly estpost summarize CollectiveEfficacy_Factor2 Age Gender Education2 HH_SES Yrs_in_Village  Ethnic_Minority  InfrastructureIndex  H6bpopulationest
eststo Togo: quietly estpost summarize CollectiveEfficacy_Factor2 Age Gender Education2 HH_SES Yrs_in_Village  Ethnic_Minority  InfrastructureIndex H6bpopulationest if Togo == 1
eststo Ghana: quietly estpost summarize CollectiveEfficacy_Factor2 Age Gender Education2 HH_SES Yrs_in_Village  Ethnic_Minority  InfrastructureIndex H6bpopulationest if Togo == 0

eststo diff: quietly estpost ttest CollectiveEfficacy_Factor2 Age Gender Education2 HH_SES Yrs_in_Village  Ethnic_Minority  InfrastructureIndex H6bpopulationest, by(Togo) unequal

esttab Combined  Ghana Togo diff, cells("mean(fmt(2)) b(star fmt(2))") ///
    mlabels("Total Sample" "Ghana" "Togo" "Diff of Means") ///
    star(* 0.1 ** 0.05 *** 0.01) ///
    title("Descriptive Statistics") 
}
	
****** TABLE 2: Model Results for Collective Efficacy Factor with Anchoring Vignettes
{
* Naive Model
use "Datasets/Original_Survey.dta", clear

revrs Q83
rename revQ83 Coll_Eff1
rename Q84 Coll_Eff2
rename CollectiveEfficacy_Factor2 Coll_Eff3

reshape long Coll_Eff, i(InstanceID) j(item)

tab item, gen(i)
rename i3 self1

for var Togo : gen s_X1 = self1*X

gen vign1 = 1-self1
eq het: vign1 self1

constraint def 1 [lns1]self1=0

eq thresh: Togo 

gllamm Coll_Eff s_Togo1 i1 i2 , robust/*
*/ i(InstanceID) link(soprobit) s(het) ethresh(thresh) constr(1) /*
*/ init

est sto CE_Factor_Basic

* Full Model
use "Datasets/Original_Survey.dta", clear

revrs Q83
rename revQ83 Coll_Eff1
rename Q84 Coll_Eff2
rename CollectiveEfficacy_Factor2 Coll_Eff3

reshape long Coll_Eff, i(InstanceID) j(item)

tab item, gen(i)
rename i3 self1

for var Age   Education2 Togo HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest InfrastructureIndex: gen s_X1 = self1*X

gen vign1 = 1-self1
eq het: vign1 self1

constraint def 1 [lns1]self1=0

eq thresh: Age  Education2 Togo HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest InfrastructureIndex

gllamm Coll_Eff s_Togo1 s_Age1  s_Education21 s_HH_SES1  s_IndEfficacy_Factor1 s_Ethnic_Minority1 s_H6bpopulationest1 s_InfrastructureIndex1 i1 i2 , robust/*
*/ i(InstanceID) link(soprobit) s(het) ethresh(thresh) constr(1) /*
*/ init

est sto CE_Factor_Full

	
* Cluster Mean
use "Datasets/Original_Survey.dta", clear

rename Q83 Coll_Eff1
rename Q84 Coll_Eff2
rename CollectiveEfficacy_Factor2 Coll_Eff3

collapse (mean) H6bpopulationest Coll_Eff3 Togo HH_SES Ethnic_Minority InfrastructureIndex, by(Village) 

oprobit Coll_Eff3 Togo H6bpopulationest InfrastructureIndex

est sto CE_ClusterMean

esttab  CE_Factor_Basic CE_Factor_Full CE_ClusterMean using "Tables Output/Table2.tex", replace /// ///
	wide se b(2) star(** 0.05 *** 0.001) ///
    title("Model Results for Collective Efficacy Factor with Anchoring Vignettes")
	
}

****** TABLE 3: Assessing the Relationship between Residing in Togo and Collective Efficacy Controlling for Potential Alternative Mechanism: Strength of Traditional Chieftaincy
{
use "Datasets/Original_Survey.dta", clear

rename Q53 ContactChief
revrs ContactChief 
rename Q125 ChiefVote
revrs ChiefVote 
rename Q21 ChiefHelp
revrs ChiefHelp 


*** PANEL A: DVs = Traditional Authorities
reg revContactChief Togo Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto ContactChief
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
reg revChiefHelp Togo Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto ChiefHelp
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
reg revChiefVote Togo Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto ChiefVote
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
	
*** PANEL B: DV = Collective Efficacy
reg CollectiveEfficacy_Factor Togo revContactChief Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto CE_ContactChief
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
reg CollectiveEfficacy_Factor Togo revChiefHelp Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto CE_ChiefHelp
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
reg CollectiveEfficacy_Factor Togo revChiefVote Age   Education HH_SES IndEfficacy_Factor H6bpopulationest, robust cluster(Village)
	est sto CE_ChiefVote
	estadd local  OLS  "Yes"
	estadd local  Ch  "No"
	estadd local  C  "Yes"
	
rename Q83 Coll_Eff1
rename Q84 Coll_Eff2
rename CollectiveEfficacy_Factor2 Coll_Eff3

reshape long Coll_Eff, i(InstanceID) j(item)
tab item, gen(i)
rename i3 self1

for var revChiefVote revChiefHelp revContactChief  Age    Education Togo HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest: gen s_X1 = self1*X

gen vign1 = 1-self1
eq het: vign1 self1

constraint def 1 [lns1]self1=0

* Chief Contact
eq thresh: Age  Education Togo  revContactChief   HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest 

gllamm Coll_Eff s_Togo1 s_revContactChief1    s_Age1  s_Education21 s_HH_SES1  s_IndEfficacy_Factor1 s_H6bpopulationest1 i1 i2 , robust /*
*/ i(InstanceID) link(soprobit) s(het) ethresh(thresh) constr(1) /*
*/ init
est sto CE_ContactChief_Chopit
 estadd local  OLS  "No"
 estadd local  Ch  "Yes"
 estadd local  C  "Yes"
 

* Chief Vote
eq thresh: Age  Education Togo  revChiefVote   HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest 

gllamm Coll_Eff s_Togo1 s_revChiefVote1    s_Age1  s_Education21 s_HH_SES1  s_IndEfficacy_Factor1 s_H6bpopulationest1 i1 i2 , robust /*
*/ i(InstanceID) link(soprobit) s(het) ethresh(thresh) constr(1) /*
*/ init


est sto CE_ChiefVote_Chopit
 estadd local  OLS  "No"
 estadd local  Ch  "Yes"
 estadd local  C  "Yes"

* Chief Help
eq thresh: Age  Education Togo  revChiefHelp   HH_SES  IndEfficacy_Factor Ethnic_Minority H6bpopulationest 

gllamm Coll_Eff s_Togo1 s_revChiefHelp1    s_Age1  s_Education21 s_HH_SES1  s_IndEfficacy_Factor1 s_H6bpopulationest1 i1 i2 , robust /*
*/ i(InstanceID) link(soprobit) s(het) ethresh(thresh) constr(1) /*
*/ init
 
est sto CE_ChiefHelp_Chopit
 estadd local  OLS  "No"
 estadd local  Ch  "Yes"
 estadd local  C  "Yes"
 
 
esttab ContactChief ChiefHelp ChiefVote  CE_ContactChief CE_ContactChief_Chopit CE_ChiefHelp CE_ChiefHelp_Chopit CE_ChiefVote CE_ChiefVote_Chopit using "Tables Output/Table3.tex", replace /// ///
	scalars("OLS OLS" "Ch CHOPIT" "C Controls") se b(3) star(** 0.05 *** 0.001) ///
    title("Assessing the Relationship between Residing in Togo and Collective Efficacy Controlling for Potential Alternative Mechanism: Strength of Traditional Chieftaincy")
}
